package itsm.isperp.workflow.dto;

import itsm.isperp.module.entity.bpm.BpmActionHistory;

import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity;

/**
 * 
 * 
 * 
 * @author lizx
 * @date 2013-10-30
 * @since 1.0
 * 
 */
public class HistoricActivityInstanceDTO extends HistoricActivityInstanceEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public HistoricActivityInstanceDTO(HistoricActivityInstance historyEntity,
			String comment) {

		this.activityId = historyEntity.getActivityId();
		this.activityName = historyEntity.getActivityName();
		this.activityType = historyEntity.getActivityType();
		this.assignee = historyEntity.getAssignee();
		this.calledProcessInstanceId = historyEntity
				.getCalledProcessInstanceId();
		this.comment = comment;
		this.durationInMillis = historyEntity.getDurationInMillis();
		this.endTime = historyEntity.getEndTime();
		this.executionId = historyEntity.getExecutionId();
		this.id = historyEntity.getId();
		this.processDefinitionId = historyEntity.getProcessDefinitionId();
		this.processInstanceId = historyEntity.getProcessInstanceId();
		this.startTime = historyEntity.getStartTime();
		this.taskId = historyEntity.getTaskId();

	}

	public HistoricActivityInstanceDTO(BpmActionHistory action) {

		this.activityName = action.getActionName();

		this.assignee = action.getActionUserId();

		this.comment = action.getComment();
		this.durationInMillis = 0L;
		this.endTime = action.getActionTime();

		this.id = action.getId();

		this.processInstanceId = action.getProcessId();
		this.startTime = action.getActionTime();
		this.taskId = action.getTaskId();
	}

	protected String comment;

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

}
